<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="u" uri="/iuie-tag"%>
<%@ taglib prefix="sys" uri="/sys-tag" %>
<%@ taglib prefix="lui" tagdir="/WEB-INF/tags" %>

<!DOCTYPE html>
<html>
<c:set var="ctx" value="${pageContext.request.contextPath }"/>
<c:set value="${pageContext.request.serverName}" var="serverName"/>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>文件模块</title>
<script type="text/javascript">
var ctx = "${ctx}";
var serverName = "${serverName}";
</script>
</head>
<u:View basePath="/res-datum/file" userJS="fileList" userCSS="fileList" delayLoadJs="false">
<body style="overflow-y:auto">
<lui:boards>
    <lui:board width="100%" boardTitle="文件管理">
		<!-- 操作搜索栏 -->
	    <div class='t-oper-bar'>
	        <div class="m-form t-uploader">
				<form class="m-cust" method="post" action="${ctx}/datum/file/doUpload" enctype="multipart/form-data" target="uploadIFrm" id='uploadFile'>
			        <iframe id="uploadIFrm" name="uploadIFrm" style="display:none;"></iframe>
					<label class="m-btn m-primary t-upload-btn" for="xFile">上传文件</label><input class='m-file' type="file" id="xFile" 
						name='file' onchange="FileListPage.onFileChanged(this)">
					<button type="submit" class="m-btn m-color-charcoal-grey t-upload-btn t-tag"><i class='fa fa-upload'></i>提交</button>
					<input type="hidden" name='fileType' value='file'>
					<input type="hidden" name='immediately' value='true'>
					<input type="hidden" name='func' value='parent.FileListPage.onUploadSucc'>
	            </form>
	        </div>
			<div class="m-form t-search">
				<!-- 搜索下面ul中的菜单 -->
				<input type="text" name='articleName' autofocus="autofocus" placeholder="搜索文件名" data-type='search' id='searchArticle'><i 
					class='fa fa-search'></i>
			</div>
		</div>
		<form id="findFileInfoFrm" class='m-cust'>
		    <input name="originalName" hidden="hidden"/>
		    <u:dropListView id="dropView_oper">
                <u:dropView name="download" template="download" onClick="FileListPage.downloadFile" title="下载"/>
                <u:dropView name="delete" template="delete" onClick="FileListPage.deleteFile" title="删除"/>
            </u:dropListView>
		    <u:dataSet id="fileInfoSet" idField="userId">
	             <u:dataField display="文件ID" name="fileId" visiable="false"/>
				 <u:dataField display="文件名" name="fileName" visiable="false"/>
				 <u:dataField display="文件原始名称" name="originalName" width="400px" align="left"/>
				 <u:dataField display="上传时间" name="uploadTime" width="135px"/>
			 	 <u:dataField display="文件大小" name="fileSize" width="100px" />
			 	 <u:dataField display="下载次数" name="downloadCount" width="80px" />
			 	 <u:dataField display="访问链接" name="visitLink" align="left"/>
			 	 <u:dataField display="操作" name="oper" dropView="dropView_oper" width="80px"/>
	         </u:dataSet>
	         <!-- 文件删除 -->
	         <lui:ajax url="${ctx }/datum/file/fileDelete" id="fileDeleteAjax" onSuccess="FileListPage.onFileDeleteSucc"/>
	         <!-- 更新下载次数 -->
	         <lui:ajax url="${ctx }/datum/file/updateDownloadCount" id="updateDownloadCountAjax" onSuccess="FileListPage.onUpdateDownloadCountSucc"/>
	         <!-- 获取文件信息列表ajax -->
	         <lui:ajax id="findFileInfoAjax" url="${ctx }/datum/file/findByPage" formQuery="#findFileInfoFrm" formSubmit="true" 
	             onSuccess="FileListPage.onQuerySucc"/>
	         <lui:datatable id="fileInfoDatatable" ajax="findFileInfoAjax" sortable="true" pagination="fileInfoPagination" dataset="fileInfoSet"
	             checkable="false" multiple="false" cutLine="true" onRenderItem="FileListPage.onRenderItem" tip="true"/>
	         <lui:pagination datatable="fileInfoDatatable" id="fileInfoPagination" pageSize="15" pageChoice="15" showPageChoice="false"/>
		</form>
	</lui:board>
</lui:boards>
</body>
</u:View>
</html>